package main

import (
	"context"
	"fmt"
	"github.com/ethereum/go-ethereum/common"
	"github.com/ethereum/go-ethereum/ethclient"
	"log"
)

func main1() {
	t1()
	return
	client, err := ethclient.Dial("https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID")
	if err != nil {
		log.Fatal(err)
	}

	address := common.HexToAddress("0x5FbDB2315678afecb367f032d93F642f64180aa3")
	balance, err := client.BalanceAt(context.Background(), address, nil)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(balance)

	//fromAddress := common.HexToAddress("0x5FbDB2315678afecb367f032d93F642f64180aa3")
	//toAddress := common.HexToAddress("0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2")
	//nonce, err := client.PendingNonceAt(context.Background(), fromAddress)
	//if err != nil {
	//	log.Fatal(err)
	//}
	//value := big.NewInt(1000000000000000000) // 1 ether
	//gasLimit := uint64(21000)
	//gasPrice, err := client.SuggestGasPrice(context.Background())
	//if err != nil {
	//	log.Fatal(err)
	//}
	//
	//lt := types.LegacyTx{
	//	Nonce:    nonce,
	//	To:       &toAddress,
	//	Value:    value,
	//	Gas:      gasLimit,
	//	GasPrice: gasPrice,
	//	Data:     nil,
	//}
	//tx := types.NewTx(&lt)
	//tx := types.NewTransaction(nonce, toAddress, value, gasLimit, gasPrice, nil)
	//signedTx, err := types.SignTx(tx, types.HomesteadSigner{}, privateKey)
	//if err != nil {
	//	log.Fatal(err)
	//}
	//err = client.SendTransaction(context.Background(), signedTx)
	//if err != nil {
	//	log.Fatal(err)
	//}
}
